/*
 * Missile.hpp
 *
 *  Created on: 19.10.2013
 *      Author: dima
 */

#ifndef MISSILE_HPP_
#define MISSILE_HPP_


#include "Types.hpp"
#include "GameObjectModel.hpp"
#include "CollisionModel.hpp"

#include <map>


namespace Tanks
{

namespace Model
{
  // Forward declarations:
  class TankModel;

  class MissileModel : public GameObjectModel
  {
  public:

    MissileModel(int argX,
                 int argY,
                 int argTeam,
                 TankModel * argOwnerTank);
    ~MissileModel();

    bool IsExploding() const { return m_exploding; }

    void SetDirection(Direction argDirection, int argVelocity = 12);

    void Collision(GameObjectModel * argGameObject,
                   CollisionModel::CollisionSide argCollisionSide,
                   bool argActive);

    static std::map<MissileModel *, TankModel *>::iterator Begin();
    static std::map<MissileModel *, TankModel *>::iterator End  ();
    static void MissileExploded(MissileModel * argMissile);

    void Tick();

  private:

    bool m_exploding;

    int m_XVelocity, m_YVelocity;

    int m_explosionStartTime, m_explosionDuration;

    Direction m_direction;

  };

}

}


#endif /* MISSILE_HPP_ */
